<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateAppCrashDetail extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('app_crash_detail', function (Blueprint $table) {
            $table->id();

            $table->bigInteger("mainId")->default(0)->comment("app_crash_main.id");

            $table->unsignedBigInteger("accessUser")->default(0)->comment("每日Crash统计 - 联网用户数");
            $table->string("version", 36)->default("")->comment("每日Crash统计 - app版本号");

            $table->unsignedBigInteger("tagId")->default(0)->comment("TAG Crash统计 - tagId");
            $table->string("tagName")->default("")->comment("TAG Crash统计 - tag名称");
            $table->unsignedInteger("type")->default(0)->comment("TAG Crash统计 - tag类型,1为sdk上设置上报,2为页面手动设置");

            $table->unsignedBigInteger("crashCount")->default(0)->comment("crash次数");
            $table->unsignedBigInteger("crashUser")->default(0)->comment("crash影响用户数");
            $table->string("url")->default("")->comment("url");

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = 'app crash详情表';

            $table->index(['mainId'], 'idx_mainId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('app_crash_detail');
    }
}
